package com.example.facadepattern;
public class HomeTheaterFacade {
    // 聚合所有子系统（依赖子系统完成功能）
    private Projector projector;
    private SoundSystem soundSystem;
    private Light light;
    private Player player;

    // 初始化子系统（实际开发中可能通过依赖注入）
    public HomeTheaterFacade() {
        this.projector = new Projector();
        this.soundSystem = new SoundSystem();
        this.light = new Light();
        this.player = new Player();
    }

    // 简化接口1：播放电影（封装复杂步骤）
    public void watchMovie(String movie) {
        System.out.println("=== 准备播放电影 ===");
        projector.on();
        projector.setMode("电影");
        soundSystem.on();
        soundSystem.setVolume(80);
        light.dim(20); // 调暗灯光
        player.play(movie);
    }

    // 简化接口2：结束观影
    public void endMovie() {
        System.out.println("\n=== 结束观影 ===");
        player.stop();
        soundSystem.off();
        projector.off();
        light.on(); // 开灯
    }
}
